package com.ruoyi.app.dyh.hxf.service.Impl;

import com.ruoyi.app.dyh.hxf.domain.Active;
import com.ruoyi.app.dyh.hxf.mapper.MyActiveMapper;
import com.ruoyi.app.dyh.hxf.service.IMyActiveService;
import com.ruoyi.project.system.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class MyActiveServiceImpl implements IMyActiveService {

    @Autowired
    private MyActiveMapper myActiveMapper;

    /**
     * 查询单个活动详细信息
     *
     * @param id I主键
     * @return
     */
    @Override
    public Active selectActiveById(String id) {
        return myActiveMapper.selectMyActiveById(id);
    }

    /**
     * 根据本人id查询服务队活动和暖心团活动
     *
     * @param active I主键
     * @return
     */
    @Override
    public List<Active> selectActiveList(Active active) {

        return myActiveMapper.selectActiveList(active);
    }

    /**
     * 删除参加的服务队活动或者暖心团活动
     *
     * @param active
     */
    @Override
    public int updateMyActiveByIds(Active active) {
        return myActiveMapper.updateMyActiveByIds(active);
    }

    /**
     * 查询角色类别
     * @param userId
     * @param activeId
     * @return
     */
    @Override
    public int selectCategoryById(Long userId, String activeId) {
        return myActiveMapper.selectCategoryById(userId,activeId);
    }
    /**
     * 修改保存用户信息
     *
     * @param user 用户信息
     * @return 结果
     */
    @Override
    @Transactional
    public int updateUser(SysUser user)
    {
        return myActiveMapper.updateUser(user);
    }
}
